#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->mountain->setGeometry(this->x(),this->y(),this->width(),this->height());
    QPixmap pixmap = QPixmap(":/mountain");

    //设置图片填满label
    ui->mountain->setScaledContents(true);
    //pixmap.scaled(ui->mountain->size());
    ui->mountain->setPixmap(pixmap);
}

Widget::~Widget()
{
    delete ui;
}

//改变窗口大小时会触发的事件
void Widget::resizeEvent(QResizeEvent *event)
{
    //qDebug() << event->size();
    ui->mountain->setGeometry(0,0,event->size().width(),event->size().height());
}
